import axios from "axios"
import { BASE_URL } from "../utils/const"

export function request(config){
  const axios1 = axios.create({
    baseURL:BASE_URL,
    method:config.method || 'GET',
    timeout:10000
  })

  axios1.interceptors.request.use((config)=>{
    if(window.sessionStorage.getItem('token')){
      config.headers.Authorization = window.sessionStorage.getItem('token')
    }
    return config
  })

  return axios1(config)
}



